<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template variant</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Histogram">
<link rel="up" href="../../../histogram/reference.html#header.boost.histogram.axis.variant_hpp" title="Header &lt;boost/histogram/axis/variant.hpp&gt;">
<link rel="prev" href="operator___idm15706.html" title="Function template operator==">
<link rel="next" href="../../../histogram/rationale.html" title="Rationale">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="operator___idm15706.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../histogram/reference.html#header.boost.histogram.axis.variant_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../histogram/rationale.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.histogram.axis.variant"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template variant</span></h2>
<p>boost::histogram::axis::variant — Polymorphic axis type. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../histogram/reference.html#header.boost.histogram.axis.variant_hpp" title="Header &lt;boost/histogram/axis/variant.hpp&gt;">boost/histogram/axis/variant.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> Ts<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">:</span>
  <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">histogram</span><span class="special">::</span><span class="identifier">axis</span><span class="special">::</span><span class="identifier">iterator_mixin</span><span class="special">&lt;</span> <span class="identifier">variant</span><span class="special">&lt;</span> <span class="identifier">Ts</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="variant.html#boost.histogram.axis.variantconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="variant.html#idm15781-bb"><span class="identifier">variant</span></a><span class="special">(</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span>
  <a class="link" href="variant.html#idm15782-bb"><span class="identifier">variant</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span>
  <a class="link" href="variant.html#idm15792-bb"><span class="identifier">variant</span></a><span class="special">(</span><a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="variant.html#idm15802-bb"><span class="identifier">variant</span></a><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> Us<span class="special">&gt;</span> <a class="link" href="variant.html#idm15814-bb"><span class="identifier">variant</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a><span class="special">&lt;</span> <span class="identifier">Us</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span> <a class="link" href="variant.html#idm15786-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span>
  <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span> <a class="link" href="variant.html#idm15796-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span> <a class="link" href="variant.html#idm15807-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> Us<span class="special">&gt;</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span> <a class="link" href="variant.html#idm15821-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a><span class="special">&lt;</span> <span class="identifier">Us</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="variant.html#idm15726-bb">public member functions</a></span>
  <span class="identifier">index_type</span> <a class="link" href="variant.html#idm15727-bb"><span class="identifier">size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">unsigned</span> <a class="link" href="variant.html#idm15730-bb"><span class="identifier">options</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="variant.html#idm15733-bb"><span class="identifier">inclusive</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="variant.html#idm15736-bb"><span class="identifier">ordered</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="variant.html#idm15739-bb"><span class="identifier">continuous</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">metadata_type</span> <span class="special">&amp;</span> <a class="link" href="variant.html#idm15742-bb"><span class="identifier">metadata</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">metadata_type</span> <span class="special">&amp;</span> <a class="link" href="variant.html#idm15746-bb"><span class="identifier">metadata</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <span class="identifier">index_type</span> <a class="link" href="variant.html#idm15750-bb"><span class="identifier">index</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">U</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">double</span> <a class="link" href="variant.html#idm15759-bb"><span class="identifier">value</span></a><span class="special">(</span><span class="identifier">real_index_type</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">auto</span> <a class="link" href="variant.html#idm15766-bb"><span class="identifier">bin</span></a><span class="special">(</span><span class="identifier">index_type</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Archive<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="variant.html#idm15773-bb"><span class="identifier">serialize</span></a><span class="special">(</span><span class="identifier">Archive</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm30988"></a><h2>Description</h2>
<div class="refsect2">
<a name="idm30990"></a><h3>
<a name="boost.histogram.axis.variantconstruct-copy-destruct"></a><code class="computeroutput">variant</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><pre class="literallayout"><a name="idm15781-bb"></a><span class="identifier">variant</span><span class="special">(</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><a name="idm15782-bb"></a><span class="identifier">variant</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><a name="idm15792-bb"></a><span class="identifier">variant</span><span class="special">(</span><a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a name="idm15802-bb"></a><span class="identifier">variant</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;&amp;</span> t<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> Us<span class="special">&gt;</span> <a name="idm15814-bb"></a><span class="identifier">variant</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a><span class="special">&lt;</span> <span class="identifier">Us</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&amp;</span> u<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span> <a name="idm15786-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span> <a name="idm15796-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span> <a name="idm15807-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;&amp;</span> t<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> Us<span class="special">&gt;</span> <a class="link" href="variant.html" title="Class template variant">variant</a> <span class="special">&amp;</span> <a name="idm15821-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a><span class="special">&lt;</span> <span class="identifier">Us</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&amp;</span> u<span class="special">)</span><span class="special">;</span></pre></li>
</ol></div>
</div>
<div class="refsect2">
<a name="idm31135"></a><h3>
<a name="idm15726-bb"></a><code class="computeroutput">variant</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">index_type</span> <a name="idm15727-bb"></a><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return size of axis. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">unsigned</span> <a name="idm15730-bb"></a><span class="identifier">options</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return options of axis or option::none_t if axis has no options. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm15733-bb"></a><span class="identifier">inclusive</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns true if the axis is inclusive or false. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm15736-bb"></a><span class="identifier">ordered</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns true if the axis is ordered or false. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm15739-bb"></a><span class="identifier">continuous</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns true if the axis is continuous or false. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">metadata_type</span> <span class="special">&amp;</span> <a name="idm15742-bb"></a><span class="identifier">metadata</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return reference to const metadata or instance of <code class="computeroutput"><a class="link" href="null_type.html" title="Struct null_type">null_type</a></code> if axis has no metadata.</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">metadata_type</span> <span class="special">&amp;</span> <a name="idm15746-bb"></a><span class="identifier">metadata</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Return reference to metadata or instance of <code class="computeroutput"><a class="link" href="null_type.html" title="Struct null_type">null_type</a></code> if axis has no metadata.</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <span class="identifier">index_type</span> <a name="idm15750-bb"></a><span class="identifier">index</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">U</span> <span class="special">&amp;</span> u<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return index for value argument. <p>Throws std::invalid_argument if axis has incompatible call signature. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">double</span> <a name="idm15759-bb"></a><span class="identifier">value</span><span class="special">(</span><span class="identifier">real_index_type</span> idx<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return value for index argument. <p>Only works for axes with value method that returns something convertible to double and will throw a runtime_error otherwise, see axis::traits::value(). </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">auto</span> <a name="idm15766-bb"></a><span class="identifier">bin</span><span class="special">(</span><span class="identifier">index_type</span> idx<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return bin for index argument. <p>Only works for axes with value method that returns something convertible to double and will throw a runtime_error otherwise, see axis::traits::value(). </p>
</li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Archive<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm15773-bb"></a><span class="identifier">serialize</span><span class="special">(</span><span class="identifier">Archive</span> <span class="special">&amp;</span> ar<span class="special">,</span> <span class="keyword">unsigned</span><span class="special">)</span><span class="special">;</span></pre></li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Hans
      Dembinski<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="operator___idm15706.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../histogram/reference.html#header.boost.histogram.axis.variant_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../histogram/rationale.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
